From: Pablo Ariño Muñoz Date: Thu, 27 Feb 2025 17:42:39 +0000 (+0100) Subject: Changed properties to designer file and hiding interval selector when notify push... X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~2^2~20^2~1 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success/%22http:/www.example.com/cgi/success?a=commitdiff_plain;h=7a4af3ea8e71f5881375f2acc2c299ebb1dafabe;p=nextcloud-desktop.git Changed properties to designer file and hiding interval selector when notify push is available Signed-off-by: Pablo Ariño Muñoz --- diff --git a/src/gui/generalsettings.cpp b/src/gui/generalsettings.cpp index fa4fa9bd2..1110ced25 100644 --- a/src/gui/generalsettings.cpp +++ b/src/gui/generalsettings.cpp @@ -21,6 +21,7 @@ #include "owncloudsetupwizard.h" #include "accountmanager.h" #include "guiutility.h" +#include "capabilities.h" #if defined(BUILD_UPDATER) #include "updater/updater.h" @@ -187,12 +188,9 @@ GeneralSettings::GeneralSettings(QWidget *parent) , _ui(new Ui::GeneralSettings) { _ui->setupUi(this); - - _ui->labelInterval->setText("seconds (if Client Push is unavailable)"); - _ui->labelInterval->setTextFormat(Qt::RichText); - _ui->labelInterval->setTextInteractionFlags(Qt::TextBrowserInteraction); - _ui->labelInterval->setOpenExternalLinks(true); + updatePollIntervalVisibility(); + connect(_ui->serverNotificationsCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::slotToggleOptionalServerNotifications); _ui->serverNotificationsCheckBox->setToolTip(tr("Server notifications that require attention.")); @@ -330,7 +328,8 @@ void GeneralSettings::loadMiscSettings() _ui->monoIconsCheckBox->setChecked(cfgFile.monoIcons()); const auto interval = cfgFile.remotePollInterval(); - _ui->remotePollIntervalSpinBox->setValue(static_cast(interval.count() / 1000)); + _ui->remotePollIntervalSpinBox->setValue(static_cast(interval.count() / 1000)); + updatePollIntervalVisibility(); } #if defined(BUILD_UPDATER) @@ -660,4 +659,19 @@ void GeneralSettings::slotRemotePollIntervalChanged(int seconds) cfgFile.setRemotePollInterval(interval); } +void GeneralSettings::updatePollIntervalVisibility() { + const auto accounts = AccountManager::instance()->accounts(); + const auto pushAvailable = std::any_of(accounts.cbegin(), accounts.cend(), + [](const AccountStatePtr &accountState) -> bool { + if (!accountState) + return false; + AccountPtr accountPtr = accountState->account(); + if (!accountPtr) + return false; + return accountPtr->capabilities().availablePushNotifications().testFlag(PushNotificationType::Files); + }); + + _ui->horizontalLayoutWidget_remotePollInterval->setVisible(!pushAvailable); +} + } // namespace OCC diff --git a/src/gui/generalsettings.h b/src/gui/generalsettings.h index 7868c4899..519a40b7f 100644 --- a/src/gui/generalsettings.h +++ b/src/gui/generalsettings.h @@ -60,6 +60,7 @@ private slots: void loadMiscSettings(); void slotShowLegalNotice(); void slotRemotePollIntervalChanged(int seconds); + void updatePollIntervalVisibility(); #if defined(BUILD_UPDATER) void slotUpdateInfo(); void slotUpdateChannelChanged(); diff --git a/src/gui/generalsettings.ui b/src/gui/generalsettings.ui index 68b53b4a8..55509ab42 100644 --- a/src/gui/generalsettings.ui +++ b/src/gui/generalsettings.ui @@ -197,50 +197,6 @@ - - - - - - Server poll interval - - - - - - - 30 - - - 999999 - - - 1 - - - - - - - seconds (if Client Push is unavailable) - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - @@ -269,6 +225,61 @@ + + + + + + + Server poll interval + + + + + + + 30 + + + 999999 + + + 1 + + + + + + + <html><head/><body><p>seconds (if <a href="https://github.com/nextcloud/notify_push"><span style=" text-decoration: underline; color:#2980b9;">Client Push</span></a> is unavailable)</p></body></html> + + + Qt::TextFormat::RichText + + + true + + + Qt::TextInteractionFlag::TextBrowserInteraction + + + + + + + Qt::Orientation::Horizontal + + + + 40 + 20 + + + + + + +